home *** CD-ROM | disk | FTP | other *** search
- /*
-
- file: OpenTptUtilities.c
- Set of utility routines for use with Open Transport
-
- */
-
- /*
- OTExtractNBPCName is useful for extracting the object, type, or zone name
- from an NBPEntity returned from an NBP Lookup call. The returned string
- is a c style, null delimited string.
-
- Input:
- entity - pointer to the entity string returned from a lookup call
- offset - number of bytes into the entity string where to begin parsing
- for the desired portion of the nbp. This call will generally
- be made three times. Pass 0 to begin reading from the
- beginning of the string. This function returns
- the number of characters read, including the delimiter character.
- Use this result as the offset to read the next nbp part.
- delimiter - pointer to character on which to terminate reading.
-
- Output:
- field - pointer to a buffer to recieve the nbp name
- result - number of characters into the buffer where the delimiter
- or null was read.
-
-
-
- */
-
- #include <Types.h>
- #include <OpenTptAppleTalk.h>
- #include "dmz.h"
-
- short OTExtractNBPCName(const NBPEntity* entity, char* field, UInt32 offset, UInt8 *delimiter)
- {
- char *p;
- short numCharsRead = 0;
-
- p = (char*) entity;
- p += offset;
- while ((*p != *delimiter) && (*p != 0))
- {
- *field = *p;
- field++;
- p++;
- numCharsRead++;
- }
- *field = 0;
- numCharsRead++;
- return (numCharsRead);
- }